package org.stvd.repository.workflow.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.stvd.core.dto.QueryResult;
import org.stvd.entities.workflow.WfIndex;
import org.stvd.repository.base.impl.BaseDaoImpl;
import org.stvd.repository.workflow.WfIndexDao;

@Repository("WfIndexDao")
public class WfIndexDaoImpl extends BaseDaoImpl<WfIndex> implements WfIndexDao {

    public QueryResult<WfIndex> getQueryResult(int start, int limit) {
        return super.getQueryResultByHQL(start, limit, "from WfIndex");
    }

    public WfIndex findByProcInstId(String procInstId) {
        List<WfIndex> list = findByHQL("from WfIndex where procInstId = ?0", procInstId);
        if(list.size() > 0){
            return list.get(0);
        }
        return null;
    }
}
